package com.sh.排序算法;

/**
 * @Auther: sh
 * @Version 1.0
 * @Description:
 */
public class 冒泡排序 {
    public static void main(String[] args) {
        int[] arr = {5, 3, 8, 4, 2, 33, 22, 14, 32, 46, 67};
        test(arr);
        for (int i : arr) {
            System.out.println(i);
        }
    }

    public static void test(int[] nums) {
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = 0; j < nums.length - 1 - i; j++) {
                if (nums[j] > nums[j + 1]) {
                    int temp = nums[j];
                    nums[j] = nums[j + 1];
                    nums[j + 1] = temp;
                }
            }
        }
    }


}

